package com.ctzj.isale;

import org.springframework.cache.interceptor.KeyGenerator;

import java.lang.reflect.Method;

/**
 * Author:  <a href="haif.yao@gmail.com">ivan</a>
 * Date: 14-11-26
 */
public class HashCodeKeyGenerator implements KeyGenerator {

    public Object generate(Object target, Method method, Object... params) {
        MethodCacheKeyGenerator methodCacheKeyGenerator = new MethodCacheKeyGenerator(target, method);
        for (Object param : params) {
            methodCacheKeyGenerator.appendRefl(param);
        }
        return methodCacheKeyGenerator.generate();
    }
}
